home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Risc World 3
/
Risc World 3.iso
/
SOFTWARE
/
ISSUE6
/
PD
/
PDF
/
GuiLib
/
Wimp
/
h
/
GuiWimpMessage
< prev
next >
Wrap
Text File
|
2003-02-14
|
5KB
|
157 lines
//--------------------------------------------------------------------------
//
// Copyright (c) 2002, Colin Granville
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following
// conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// * The name Colin Granville may not be used to endorse or promote
// products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//
//--------------------------------------------------------------------------
#ifndef GuiWimpMessage_h
#define GuiWimpMessage_h
// GuiMouseClickBlock defined in GuiWimp.h before including this file
// #include GuiWimp.h to use this header
#define GuiWimp_MQuit 0
#define GuiWimp_MDataSaveAck 2
#define GuiWimp_MDataLoad 3
#define GuiWimp_MDataLoadAck 4
#define GuiWimp_MDataOpen 5
#define GuiWimp_MPrintFile 0x80140
#define GuiWimp_MWillPrint 0x80141
#define GuiWimp_MPrintSave 0x80142
#define GuiWimp_MPrintInit 0x80143
#define GuiWimp_MPrintError 0x80144
#define GuiWimp_MPrintTypeOdd 0x80145
#define GuiWimp_MPrintTypeKnown 0x80146
#define GuiWimp_MSetPrinter 0x80147
class GuiWimpMessageBase
{
public:
struct
{
int size;
int sender;
int myRef;
int yourRef;
int actionCode;
} hdr;
// all methods return myRef uno
// sends set your_ref to 0
// if window_or_dest_task_handle==0 then message is broadcast
int send(int mess_code,int window_or_dest_task_handle=0,int icon_handle=0);
int sendRecorded(int mess_code,int window_or_dest_task_handle=0,int icon_handle=0);
//replies set your_ref=my_ref;
int reply(int mess_code);
int replyRecorded(int mess_code);
int acknowledge();
// to is a char* in the GuiWimpMessage
// sets hdr.size
// returns ptr to terminating 0 or zero if to not in header;
char* copyString(char* to,const char* from);
// char* points to end of string (after terminating 0)
// sets to GuiWimpMessage::MAX_SIZE if not valid ptr
void setSize(const char*);
};
class GuiPointerPosition
{
public:
int windowHandle;
int iconHandle;
int x;
int y;
void set(GuiMouseClickBlock& p) {windowHandle=p.windowHandle,iconHandle=p.iconHandle,x=p.x,y=p.y;}
void set(int w,int i,int _x,int _y) {windowHandle=w,iconHandle=i,x=_x,y=_y;}
void operator()(GuiMouseClickBlock& p) {set(p);}
void operator()(int w,int i,int x,int y) {set(w,i,x,y);}
};
struct GuiWimpDataSaveMessage
{
public:
GuiPointerPosition destination;
int estimatedSize;
int fileType;
char leafName [212];
};
struct GuiWimpDataSaveAckMessage : public GuiWimpDataSaveMessage {};
struct GuiWimpDataLoadMessage : public GuiWimpDataSaveMessage {};
struct GuiWimpDataLoadAckMessage : public GuiWimpDataSaveMessage {};
struct GuiWimpDataOpen
{
int windowHandle;
int padding1;
int x;
int y;
int padding2;
int fileType;
char pathName[212];
};
//***************************************************************************
class GuiWimpMessage : public GuiWimpMessageBase
{
public:
enum {MAX_SIZE=256};
union
{
GuiWimpDataSaveMessage dataSave;
GuiWimpDataSaveAckMessage dataSaveAck;
GuiWimpDataLoadMessage dataLoad;
GuiWimpDataLoadAckMessage dataLoadAck;
GuiWimpDataOpen dataOpen;
} data;
};
#endif